import sys
import random

def f(s1,s2):
    return  sum(map(lambda ch:s2.count(ch),s1)) 

a=[['Readability counts.','The Zen of Python.']]
import string
s=string.printable[:-5]
for i in range(9):
    n=random.randint(3,255)
    s1=''.join([random.choice(s) for j in range(n)])
    n=random.randint(3,255)
    s2=''.join([random.choice(s) for j in range(n)])
    a.append([s1,s2])


for i  in range(10):
    fin = open('{}.in'.format(i+1),'w')
    fout = open('{}.out'.format(i+1),'w')
    print(a[i][0],file=fin)
    print(a[i][1],file=fin)
    print(f(a[i][0],a[i][1]),file=fout)
    fin.close()
    fout.close()
